﻿using System;
using System.Collections.Generic;
using System.Text;
using KGE.Define;

namespace KGE.Resource
{
    public class KImagePackages
    {
        List<KImagePackage> items = new List<KImagePackage>();
        public int GetIndex(string name)
        {
            int i = 0;
            foreach (KImagePackage kip in items)
            {
                if (name.ToLower() == kip.Name.ToLower())
                {
                    return i;
                }
                i++;
            }
            return -1;
        }
        public void Add(KImagePackage item)
        {
            items.Add(item);
        }
        public void Del(string name)
        {
            int i = GetIndex(name);
            items.RemoveAt(i);
        }
        public void Del(int index)
        {
            items.RemoveAt(index);
        }
        public int Count
        {
            get
            {
                return items.Count;
            }
        }
        public KImagePackage this[int index]
        {
            get
            {
                return items[index];
            }
        }
        public KImagePackage this[string name]
        {
            get
            {
                int i = GetIndex(name);
                return items[i];
            }
        }
        public KImage this[int p_index, int i_index]
        {
            get
            {
                return this[p_index][i_index];
            }
        }
        public KImage this[string name, int index]
        {
            get
            {
                return this[name][index];
            }
        }
    }
}
